<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #btn
        {
            width: 200px;
            height: 50px;
            font-size: 20px;
            text-align: center;
        }
    </style>
</head>
<body>
    <input type="button" id="btn" value="生成乘法表">
    <table border="1" id="table"></table>
</body>
<script>
    var btn = document.getElementById("btn")
    var table = document.getElementById("table")

    btn.onclick= function () 
    {
        var str=""
        for(var row = 0; row < 9 ; row++ )
        {
            var tds = "" ;
            for(var col = 0 ; col < 9 ; col++ )
            {
                tds += "<td>"+ (row + 1) + "*" + (col + 1) + "=" + ((row + 1)*(col + 1)) +"</td>"
            }
            str += "<tr>" + tds + "</tr>"
        }
        table.innerHTML = str;
    }
</script>
</html>